# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=ayatana-indicator-power
pkgver=24.1.0
pkgrel=0
pkgdesc="Ayatana Indicator Power Applet"
url="https://github.com/AyatanaIndicators/ayatana-indicator-power"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	dbus-test-runner-dev
	glib-dev
	gtest-dev
	intltool
	libayatana-common-dev
	libnotify-dev
	librda-dev
	samurai
	"
checkdepends="dbus dbus-test-runner"
subpackages="$pkgname-lang"
source="https://github.com/AyatanaIndicators/ayatana-indicator-power/archive/$pkgver/ayatana-indicator-power-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DENABLE_TESTS=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
dbc294a4f43ecb7829ffb1d1717430eae5a7d54f567dd5f0542078d49fe19290ea1521ac25566bf02fd9873fa710be1c2982f4d3c1d61933e29055084d42303b  ayatana-indicator-power-24.1.0.tar.gz
"
